/**
 * 管理员用户模块
 * 创建管理员
 * 修改管理员信息
 */
module.exports = class extends think.Model {
  /// 获取网站配置
  async configs () {
      const db = think.mongoose('mongo/config')
      let config = await db.findOne({})
      if (!config) {
        config = {
          kfqq: '',
          kfwx: '',
          notice: ''
        }
        let doc = new db(config)
        await doc.save()
      }
      return config
  }
  /// 获取支付配置
  async aliConfig () {
      const db = think.mongoose('mongo/alipay')
      let config = await db.findOne({})
      if (!config) {
        let doc = new db({})
        config = await doc.save()
      }
      return config
  }
  /// 获取广告配置
  async adConfig () {
      const db = think.mongoose('mongo/ad_config')
      let config = await db.findOne({})
      if (!config) {
        let doc = new db({})
        config = await doc.save()
      }
      return config
  }
};
